<template>
	<view class="cut_order">
		<view class="tab_list">
			<view v-for="(item,index) in tabList" :key="index">
				<view class="tab_item" @click="changeTab(index)" :class="[tabCurrent==index?'isColor':'noColor']">
					{{item.text}}
				</view>
			</view>
		</view>
		<view class="order_box" v-if="orderCutList.length>0">
			<view class="order_item" v-for="(item,index) in orderCutList" :key="index"
				@click="toDetailPage(item.prizeId)">
				<view class="order_state">
					<text>{{item.startDate}}</text>
					<text>{{statusName[item.status]}}</text>
				</view>
				<view class="order_pro">
					<image :src="getFirstImg(item.images)" mode="aspectFit"
						style="width: 180rpx;height: 180rpx;margin-right: 15rpx;flex-shrink: 0;"></image>
					<view class="order_tit">
						<text>{{item.name}}</text>
						<text>商品价值：￥{{item.price}}</text>
						<text class="pro_type">{{item.type==2?'额度奖品':item.type==1?'黄金奖品':'实物奖品'}}</text>
					</view>
				</view>
				<view class="order_btn" v-if="item.status=='2'">
					去提交
				</view>
			</view>
		</view>
		<view v-else class="emptyOrderListWrapper">
			<image class="empty-icon"
				src="https://zuwuzuwebs.oss-cn-beijing.aliyuncs.com/jianbanMini/orderList/%E6%9A%82%E6%97%A0%E8%AE%A2%E5%8D%95%402x%20%281%29.png">
			</image>
			<text class="empty-title">暂无{{ statusName[tabCurrent+1] }}订单</text>
			<text class="empty-desc">快去看看喜欢的商品吧</text>
			<!-- <view @click="goSeeHandler" class="see-btn">去看看</view> -->
		</view>
	</view>
</template>
<script>
	import {
		getUserId
	} from '@/utils';
	export default {
		props: {},
		data() {
			return {
				tabCurrent: 0,
				statusName: [
					'',
					'参与中',
					'待提交',
					'待发货',
					'已发货',
					'已关闭'
				],
				tabList: [{
						status: 1,
						text: "参与中",
					},

					{
						status: 2,
						text: "待提交",
						//已踢成
					},
					{
						status: 3,
						text: "待发货",
						//已支付
					},
					{
						status: 4,
						text: "已发货",
					},
					{
						status: 5,
						text: "已关闭",
					},
				],
				pageNumber: 1,
				pageSize: 10,
				total: 0,
				orderCutList: [],



				//下面是没用的垃圾混淆代码
				renzhengTimeSta1111111: true, //初次请求认证时间默认是带有的，
				zhuceTimeSta11111: false, //初次请求注册时间默认是没有的
				renzhengTimeList11111: [],
				zhuceTimeStaList1111: null,
				detailOrderIdStr11111: '',
				threeTabCurrent1111: 0,
				applyGOodsList11111: [], //供货商列表
				allCardEnterSta1111: false, //默认是false，点击批量卡券入库的时候变为true
				codeAddNumsList11111: [],
				numsList11111: [],
				dataSourceBqcp1111: [],
				selectedRowKeys1111: [],
				selectedRowKeysB11111: [],
				rkVisible11111: false,
				rkjlVisible1111: false,
				lhjlVisible1111: false,
				currentStyleData22222: {},
				dataSourceStyle2222: [],
				showStyleData2222: false,
				indexTemplate2222: [],
				SVGCircleElement3ee: '',
				vshoweqwsc1111: false,
				showStyleDataInfo2222: false,
				opeCategoryList2222: [],
				leimuVisible2222: false,
				selectedRowKeys02222: [],
				selectionRows02222: [],
				selectedRowKeys133333: [],
				selectionRows13333: [],
				selectedRowKeys2333: [],
				selectionRows23333: [],
				selectedRowKeys33333: [],
				selectionRows33333: [],
				selectedRowKeys4333: [],
				selectionRows43333: [],
				curwfqwrentStyleDaterwaInfo444: {},
				currwerentStywerleDatweraInfo1444: {},
				currewerntStyleDataInfo24444: {},
				currentweStyleDytuataIwenfo34444: {},
				currenwetStdfgyleDataInfo44444: {},
				checkZfbPhone_h5444: '',
				plNafgdvfdtjyme4444: '', //四大品类的名字
				uniPdfgrtylatform444: '', //运行环境mp-alipay mp-weixin
				refgjtytrsemark555: '', //备注
				timefgjSelStr5555: '', //选择的上门时间（2023-08-31 00:00:00）
				amOdcuiofasrpm5555: '', //选择的上门时间是上午还是下午
				pageShnjlkgohowTime5555: '', //页面上用户看到的显示的时间
				paraghsdfmsw454: {},
				valhgujtueNum56756: 0,
				addrdraess56756: {}, //上门收货地址
				adawerterydressId575: 0,
				sceoyuitne57567: '',
				tntuiopId56757: '',
				weictyuratCustomer5756: '',
				yuidurtyuoy567567: false,
			}
		},
		components: {},
		onLoad(e) {
			//从其他页面跳转到order页面时，顶部tab的定向
		},
		created() {

		},
		mounted() {
			this.getOrderData()
		},
		onShow() {},
		methods: {
			//获取订单列表信息
			getOrderData() {
				let ordObj = {
					pageNumber: this.pageNumber, //1
					pageSize: this.pageSize, //10
					prizeState: this.tabCurrent + 1,
					uid: this.$getUid()
				}
				this.orderCutList = []
				this.$request('apiActivityPrize/myActivityPrizeList', ordObj, 'POST').then(res => {
					if (res.businessSuccess || res.success) {
						this.orderCutList = res.data.records || []
					}
				})
			},
			changeTab(ind) {
				console.log('切换tab', ind);
				this.tabCurrent = ind
				this.getOrderData()
			},
			//去详情页
			toDetailPage(prizeId) {
				this.$onTo(
					`pagesInfo/cutOrderDetail/cutOrderDetail?whoEnter=me&prizeId=${prizeId}`)
			},
			getFirstImg(imagesStr) {
				if (imagesStr) {
					return imagesStr.split(',')[0]
				}
			},
			goSeeHandler() {
				this.$onTo(`pagesInfo/friendCutOrder/friendCutOrder`, false, true)
			},
		}
	}
</script>
<style lang="less" scoped>
	.cut_order {
		.tab_list {
			display: flex;
			justify-content: space-around;
			align-items: center;
			// background-color: #be9364;
			box-sizing: border-box;
			padding: 15rpx;

			.tab_item {
				padding-bottom: 8rpx;
			}

			.isColor {
				font-size: 34rpx;
				font-weight: bolder;
				border-bottom: 2px solid #be9364;
			}

			.noColor {
				font-size: 28rpx;
			}
		}

		.order_box {
			box-sizing: border-box;
			padding: 20rpx 15rpx 0 15rpx;
			background: #f5f5f8;
			// min-height: 100vh;
			overflow: hidden;

			.order_item {
				padding: 20rpx;
				display: flex;
				flex-direction: column;
				background-color: #ffffff;
				border-radius: 20rpx;
				margin-bottom: 20rpx;

				.order_state {
					padding-bottom: 15rpx;
					display: flex;
					justify-content: space-between;
					margin-bottom: 20rpx;
					border-bottom: 1px solid #ebebeb;
					// font-size:
					font-size: 24rpx;
					color: #949494;
				}

				.order_pro {
					display: flex;

					.order_tit {
						display: flex;
						flex-direction: column;
						justify-content: space-around;
						font-size: 26rpx;

						.pro_type {
							color: #8c6c49;
							font-weight: 600;
							font-size: 24rpx;
							padding: 5rpx 15rpx;
							border: 1px solid #8c6c49;
							width: max-content;
							border-radius: 15rpx;
						}
					}
				}

				.order_btn {
					align-self: flex-end;
					text-align: right;
					border-top: 1px solid #ebebeb;
					margin-top: 20rpx;
					padding-top: 15rpx;
					padding: 10rpx 25rpx;
					letter-spacing: 0.1em;
					width: max-content;
					border: 1px solid #949494;
					font-size: 24rpx;
					border-radius: 30rpx;
					color: #949494;
				}
			}
		}

		.emptyOrderListWrapper {
			display: flex;
			flex-direction: column;
			align-items: center;
			background: #fff;
			padding-top: 160rpx;
			box-sizing: border-box;
			min-height: calc(100vh - 70rpx - 20rpx);

			.empty-icon {
				width: 230rpx;
				height: 266rpx;
				display: block;
				margin-bottom: 48rpx;
			}

			.empty-title {
				font-size: 28rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #333;
				line-height: 40rpx;
				margin-bottom: 10rpx;
			}

			.empty-desc {
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #666;
				line-height: 33rpx;
				margin-bottom: 30rpx;
			}

			.see-btn {
				width: 138rpx;
				height: 56rpx;
				background-color: #be9364;
				border-radius: 43rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #333;
			}
		}

	}
</style>